<template>
  <div class="app-container home">
    <div class="dashboard-container">
      <!-- 个人信息部分 -->
      <div class="info-section">
        <el-row>
          <el-col :span="12">
            <el-card class="info-card">
              <div class="header">
                <el-button type="text" icon="el-icon-s-home">首页</el-button>
              </div>
              <div class="avatar-section">
                <img src="https://via.placeholder.com/100x100" alt="头像" />
                <div class="user-info">
                  <p>2025年3月2日 星期天</p>
                  <h3>管理员</h3>
                  <el-button type="text" icon="el-icon-edit-outline"
                    >修改头像</el-button
                  >
                </div>
              </div>
              <div class="detail-info">
                <p>生日：2000-12-05</p>
                <p>地址：广东省广州市天河区</p>
                <p>部门：管理员</p>
              </div>
            </el-card>
          </el-col>
          <el-col :span="12">
            <el-row :gutter="10">
              <el-col :span="4">
                <el-card class="status-card" bg-color="#409EFF">
                  <div class="icon-container">
                    <el-icon><User /></el-icon>
                  </div>
                  <div class="text-container">
                    <p>员工总数</p>
                    <h2>{{ employeeCount }}</h2>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4">
                <el-card class="status-card" bg-color="#67c23a">
                  <div class="icon-container">
                    <el-icon><CheckMark /></el-icon>
                  </div>
                  <div class="text-container">
                    <p>状态正常</p>
                    <h2>{{ normalCount }}</h2>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4">
                <el-card class="status-card" bg-color="#f56c6c">
                  <div class="icon-container">
                    <el-icon><WarningFilled /></el-icon>
                  </div>
                  <div class="text-container">
                    <p>状态异常</p>
                    <h2>{{ abnormalCount }}</h2>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4">
                <el-card class="status-card" bg-color="#409EFF">
                  <div class="icon-container">
                    <el-icon><Mask /></el-icon>
                  </div>
                  <div class="text-container">
                    <p>今日迟到</p>
                    <h2>{{ lateCount }}</h2>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4">
                <el-card class="status-card" bg-color="#67c23a">
                  <div class="icon-container">
                    <el-icon><RotateRight /></el-icon>
                  </div>
                  <div class="text-container">
                    <p>今日早退</p>
                    <h2>{{ earlyLeaveCount }}</h2>
                  </div>
                </el-card>
              </el-col>
              <el-col :span="4">
                <el-card class="status-card" bg-color="#f56c6c">
                  <div class="icon-container">
                    <el-icon><Setting /></el-icon>
                  </div>
                  <div class="text-container">
                    <p>今日旷工</p>
                    <h2>{{ absentCount }}</h2>
                  </div>
                </el-card>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
      </div>
      <!-- 日历和图表部分 -->
      <div class="charts-section">
        <el-row :gutter="10">
          <el-col :span="8">
            <el-card class="calendar-card">
              <h3>2025年3月</h3>
              <div class="calendar-buttons">
                <el-button type="text">上个月</el-button>
                <el-button type="text">今天</el-button>
                <el-button type="text">下个月</el-button>
              </div>
              <el-calendar v-model="selectedDate">
                <template #dateCell="{ date, data }">
                  <div class="date-cell">
                    <span>{{ date.day }}</span>
                    <span
                      v-if="calendarData[date.day] === '休假'"
                      class="status-tag"
                      >{{ calendarData[date.day] }}</span
                    >
                    <span v-else class="status-tag">正常</span>
                  </div>
                </template>
              </el-calendar>
            </el-card>
          </el-col>
          <el-col :span="8">
            <el-card class="insurance-card">
              <h3>部分城市社保缴费比例</h3>
              <el-chart type="line" :data="insuranceData">
                <el-chart-series
                  name="养老保险"
                  x-key="city"
                  y-key="pension"
                  :symbol="false"
                ></el-chart-series>
                <el-chart-series
                  name="医疗保险"
                  x-key="city"
                  y-key="medical"
                  :symbol="false"
                ></el-chart-series>
                <el-chart-series
                  name="失业保险"
                  x-key="city"
                  y-key="unemployment"
                  :symbol="false"
                ></el-chart-series>
                <el-chart-series
                  name="生育保险"
                  x-key="city"
                  y-key="maternity"
                  :symbol="false"
                ></el-chart-series>
              </el-chart>
            </el-card>
          </el-col>
          <el-col :span="4">
            <el-card class="join-card">
              <h3>2025年员工入职情况</h3>
              <el-chart type="line" :data="joinData">
                <el-chart-series
                  name="人数"
                  x-key="quarter"
                  y-key="count"
                  :symbol="false"
                ></el-chart-series>
              </el-chart>
            </el-card>
          </el-col>
          <el-col :span="4">
            <el-card class="distribution-card">
              <h3>员工分布情况</h3>
              <el-chart
                type="pie"
                :data="departmentDistribution"
                :legend="false"
              >
                <el-chart-series
                  name="部门"
                  x-key="name"
                  y-key="value"
                ></el-chart-series>
              </el-chart>
            </el-card>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script setup name="Index"></script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>
